#include <iostream>
#include <math.h>
using namespace std;

int main (void) {
  int A, B, C;
  
  cout << "please enter A:"; cin >> A;
  cout << "please enter B:"; cin >> B;
  cout << "please enter C:"; cin >> C;
  
  int ABC = 100*A + 10*B + C;
  int BCA = 100*B + 10*C + A;
  int CAB = 100*C + 10*A + B;
  
  int X = ABC%11;
  int Y = BCA%11;
  int Z = CAB%11; 
  int NewSum[] = {X+Y, Y+Z, X+Z};
  
  for (int i = 0; i < 3; i++) {
    if (NewSum[i] == 9) {
	 cout << "You got 9!" << endl;
	 break;}
	else if (NewSum[i]%2 == 1) {
	  if (NewSum[i] < 9) {
	    NewSum[i] += 11;}
	  else if (NewSum[i] > 9) {
	    NewSum[i] -= 11;}
	}
  NewSum[i] = NewSum[i]/2;
  }
  
  cout << "You input:" << A << "," << B << "," << C << endl;
  cout << "You got:" << NewSum[0] << "," << NewSum[1] << "," << NewSum[2] << endl;
  }
  
  
